/**
 * Threed module
 */

import React from 'react';
import tool from '../../../../../utils/tool';

class Threed extends React.Component {
    render() {
        const widget = this.props.widget;
        const gradColor = tool.converionColor((widget.color || 'f76b1c'));
        const grad = `linear-gradient(140deg, rgb(${gradColor.R},${gradColor.G},${gradColor.B}),#${widget.color})`;
        return (
          <div className="widget-inline" style={{ background: widget.icon_src ? 'none' : grad }}>
            <div className={widget.icon_class} style={{ color: '#000' }} />
            <div className="threed-state" data-threed-state={widget.url} style={{ background: grad }}>
              <div>
                <p ref="msg1">{widget.msg1}</p>
                <p ref="msg2">{widget.msg2}</p>
              </div>
            </div>
          </div>
        );
    }
}
Threed.defaultProps = {
    name: "model_3d",
    type: 5,
    width: 45,
    height: 45,
    color: "f76b1c",
    type_display: $._("3D Model"),
    icon_class: "icon-cube",
    light: { intensity:0.35 },
    select_animation: -1,
    scale: 1,
    auto_play: 1
}
export default Threed;
